package zx.x.modules.yshapp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.Query;
import zx.x.modules.yshapp.dao.OrderAppDao;
import zx.x.modules.yshapp.entity.GoodsEntity;
import zx.x.modules.yshapp.entity.YOrderEntity;
import zx.x.modules.yshapp.service.OrderService;

import java.util.Map;


@Service("orderAppService")
public class OrderAppServiceImpl extends ServiceImpl<OrderAppDao, YOrderEntity> implements OrderService {
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String userId = (String)params.get("userId");

        IPage<YOrderEntity> page = this.page(
                new Query<YOrderEntity>().getPage(params),
                new QueryWrapper<YOrderEntity>().eq(StringUtils.isNotBlank(userId),"user_id", userId)
                        .eq("delete_flag",0).orderBy(true,false,"cj_time")
        );
        return new PageUtils(page);
    }

}